package controller;

import entity.Colortype;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import service.ColortypeService;

import javax.annotation.Resource;
import java.util.List;

@Controller
@RequestMapping("/color")
public class ColortypeCon {
    @Resource(name="colortypeService")
    private ColortypeService colortypeService;

    @RequestMapping("/query")
    @ResponseBody
    public List<Colortype> list(){
        return colortypeService.list();
    }

    @RequestMapping("/add")
    @ResponseBody
    public List<Colortype> add(String name){
        int i = colortypeService.add(name);
        return list();
    }

}
